home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / motion.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  37.9 KB  |  1,017 lines

  1. *motion.txt*    For Vim version 6.0.  Last change: 2001 Sep 05
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Cursor motions                    *cursor-motions* *navigation*
  8.  
  9. These commands move the cursor position.  If the new position is off of the
  10. screen, the screen is scrolled to show the cursor (see also 'scrolljump' and
  11. 'scrolloff' options).
  12.  
  13. 1. Motions and operators    |operator|
  14. 2. Left-right motions        |left-right-motions|
  15. 3. Up-down motions        |up-down-motions|
  16. 4. Word motions            |word-motions|
  17. 5. Text object motions        |object-motions|
  18. 6. Text object selection    |object-select|
  19. 7. Marks            |mark-motions|
  20. 8. Jumps            |jump-motions|
  21. 9. Various motions        |various-motions|
  22.  
  23. General remarks:
  24.  
  25. If you want to know where you are in the file use the "CTRL-G" command
  26. |CTRL-G| or the "g CTRL-G" command |g_CTRL-G|.  If you set the 'ruler' option,
  27. the cursor position is continuously shown in the status line (which slows down
  28. Vim a little).
  29.  
  30. Experienced users prefer the hjkl keys because they are always right under
  31. their fingers.  Beginners often prefer the arrow keys, because they do not
  32. know what the hjkl keys do.  The mnemonic value of hjkl is clear from looking
  33. at the keyboard.  Think of j as an arrow pointing downwards.
  34.  
  35. The 'virtualedit' option can be set to make it possible to move the cursor to
  36. positions where there is no character or halfway a character.
  37.  
  38. ==============================================================================
  39. 1. Motions and operators                *operator*
  40.  
  41. The motion commands can be used after an operator command, to have the command
  42. operate on the text that was moved over.  That is the text between the cursor
  43. position before and after the motion.  Operators are generally used to delete
  44. or change text.  The following operators are available:
  45.  
  46.     |c|    c    change
  47.     |d|    d    delete
  48.     |y|    y    yank into register (does not change the text)
  49.     |~|    ~    swap case (only if 'tildeop' is set)
  50.     |g~|    g~    swap case
  51.     |gu|    gu    make lowercase
  52.     |gU|    gU    make uppercase
  53.     |!|    !    filter through an external program
  54.     |=|    =    filter through 'equalprg' or C-indenting if empty
  55.     |gq|    gq    text formatting
  56.     |g?|    g?    ROT13 encoding
  57.     |>|    >    shift right
  58.     |<|    <    shift left
  59.     |zf|    zf    define a fold
  60.  
  61. If the motion includes a count and the operator also had a count before it,
  62. the two counts are multiplied.  For example: "2d3w" deletes six words.
  63.  
  64. After applying the operator the cursor is mostly left at the start of the text
  65. that was operated upon.  For example, "yfe" doesn't move the cursor, but "yFe"
  66. moves the cursor leftwards to the "e" where the yank started.
  67.  
  68.                         *linewise* *characterwise*
  69. The operator either affects whole lines, or the characters between the start
  70. and end position.  Generally, motions that move between lines affect lines
  71. (are linewise), and motions that move within a line affect characters (are
  72. characterwise).  However, there are some exceptions.
  73.  
  74.                         *exclusive* *inclusive*
  75. A character motion is either inclusive or exclusive. When inclusive, the start
  76. and end position of the motion are included in the operation.  When exclusive,
  77. the last character towards the end of the buffer is not included.  Linewise
  78. motions always include the start and end position.
  79.  
  80. Which motions are linewise, inclusive or exclusive is mentioned below.  There
  81. are however, two general exceptions:
  82. 1. If the motion is exclusive and the end of the motion is in column 1, the
  83.    end of the motion is moved to the end of the previous line and the motion
  84.    becomes inclusive.  Example: "}" moves to the first line after a paragraph,
  85.    but "d}" will not include that line.
  86. 2. If the motion is exclusive, the end of the motion is in column 1 and the
  87.    start of the motion was at or before the first non-blank in the line, the
  88.    motion becomes linewise.  Example: If a paragraph begins with some blanks
  89.    and you do "d}" while standing on the first non-blank, all the lines of
  90.    the paragraph are deleted, including the blanks.  If you do a put now, the
  91.    deleted lines will be inserted below the cursor position.
  92.  
  93. Note that when the operator is pending (the operator command is typed, but the
  94. motion isn't yet), a special set of mappings can be used.  See |:omap|.
  95.  
  96. Instead of first giving the operator and then a motion you can use Visual
  97. mode: mark the start of the text with "v", move the cursor to the end of the
  98. text that is to be affected and then hit the operator.  The text between the
  99. start and the cursor position is highlighted, so you can see what text will
  100. be operated upon.  This allows much more freedom, but requires more key
  101. strokes and has limited redo functionality.  See the chapter on Visual mode
  102. |Visual-mode|.
  103.  
  104.  
  105. Forcing a motion to be linewise, characterwise or blockwise
  106.  
  107. When a motion is not of the type you would like to use, you can force another
  108. type by using "v", "V" or CTRL-V just after the operator.
  109. Example: >
  110.     dj
  111. deletes two lines >
  112.     dvj
  113. deletes from the cursor position until the character below the cursor >
  114.     d<C-V>j
  115. deletes the character under the cursor and the character below the cursor. >
  116.  
  117. Be careful with forcing a linewise movement to be used characterwise or
  118. blockwise, the column may not always be defined.
  119.  
  120.                             *o_v*
  121. v        When used after an operator, before the motion command: Force
  122.         the operator to work characterwise, also when the motion is
  123.         linewise.  If the motion was linewise, it will become
  124.         |exclusive|.
  125.  
  126.                             *o_V*
  127. V        When used after an operator, before the motion command: Force
  128.         the operator to work linewise, also when the motion is
  129.         characterwise.
  130.  
  131.                             *o_CTRL-V*
  132. CTRL-V        When used after an operator, before the motion commmand: Force
  133.         the operator to work blockwise.  This works like Visual block
  134.         mode selection, with the corners defined by the cursor
  135.         position before and after the motion.
  136.  
  137. ==============================================================================
  138. 2. Left-right motions                    *left-right-motions*
  139.  
  140. h        or                    *h*
  141. <Left>        or                    *<Left>*
  142. CTRL-H        or                    *CTRL-H* *<BS>*
  143. <BS>            [count] characters to the left.  |exclusive| motion.
  144.             Note: If you prefer <BS> to delete a character, use
  145.             the mapping:
  146.                 :map CTRL-V<BS>        X
  147.             (to enter "CTRL-V<BS>" type the CTRL-V key, followed
  148.             by the <BS> key)
  149.             See |:fixdel| if the <BS> key does not do what you
  150.             want.
  151.  
  152. l        or                    *l*
  153. <Right>        or                    *<Right>* *<Space>*
  154. <Space>            [count] characters to the right.  |exclusive| motion.
  155.  
  156.                             *0*
  157. 0            To the first character of the line.  |exclusive|
  158.             motion.  When moving up or down, stay in same screen
  159.             column (if possible).
  160.  
  161.                             *<Home>* *<kHome>*
  162. <Home>            To the first character of the line.  |exclusive|
  163.             motion.  When moving up or down, stay in same text
  164.             column (if possible).  Works like "1|", which differs
  165.             from "0" when the line starts with a <Tab>.  {not in
  166.             Vi}
  167.  
  168.                             *^*
  169. ^            To the first non-blank character of the line.
  170.             |exclusive| motion.
  171.  
  172.                             *$* *<End>* *<kEnd>*
  173. $  or <End>        To the end of the line and [count - 1] lines downward
  174.             (inclusive).  When 'virtualedit' is active, "$" may
  175.             move the cursor back from past the end of the line to
  176.             the last character in the line.
  177.  
  178.                             *g_*
  179. g_            To the last non-blank character of the line and
  180.             [count - 1] lines downward (inclusive). {not in Vi}
  181.  
  182.                             *g0* *g<Home>*
  183. g0 or g<Home>        When lines wrap ('wrap on): To the first character of
  184.             the screen line.  |exclusive| motion.  Differs from
  185.             "0" when a line is wider than the screen.
  186.             When lines don't wrap ('wrap' off): To the leftmost
  187.             character of the current line that is on the screen.
  188.             Differs from "0" when the first character of the line
  189.             is not on the screen.  {not in Vi}
  190.  
  191.                             *g^*
  192. g^            When lines wrap ('wrap' on): To the first non-blank
  193.             character of the screen line.  |exclusive| motion.
  194.             Differs from "^" when a line is wider than the screen.
  195.             When lines don't wrap ('wrap' off): To the leftmost
  196.             non-blank character of the current line that is on the
  197.             screen.  Differs from "^" when the first non-blank
  198.             character of the line is not on the screen.  {not in
  199.             Vi}
  200.  
  201.                             *gm*
  202. gm            Like "g0", but half a screenwidth to the right (or as
  203.             much as possible). {not in Vi}
  204.  
  205.                             *g$* *g<End>*
  206. g$ or g<End>        When lines wrap ('wrap' on): To the last character of
  207.             the screen line and [count - 1] screen lines downward
  208.             (inclusive).  Differs from "$" when a line is wider
  209.             than the screen.
  210.             When lines don't wrap ('wrap' off): To the rightmost
  211.             character of the current line that is visible on the
  212.             screen.  Differs from "$" when the last character of
  213.             the line is not on the screen or when a count is used.
  214.             {not in Vi}
  215.  
  216.                             *bar*
  217. |            To screen column [count] in the current line.
  218.             |exclusive| motion.
  219.  
  220.                             *f*
  221. f{char}            To [count]'th occurrence of {char} to the right.  The
  222.             cursor is placed on {char} (inclusive).
  223.             {char} can be entered as a digraph |digraph-arg|.
  224.             When 'encoding' is set to Unicode, composing
  225.             characters may be used, see |utf-8-char-arg|.
  226.             |:lmap| mappings apply to {char}.  The CTRL-^ command
  227.             in Insert mode can be used to switch this on/off
  228.             |i_CTRL-^|.
  229.  
  230.                             *F*
  231. F{char}            To the [count]'th occurrence of {char} to the left.
  232.             The cursor is placed on {char} (inclusive).
  233.             {char} can be entered like with the |f| command.
  234.  
  235.                             *t*
  236. t{char}            Till before [count]'th occurrence of {char} to the
  237.             right.  The cursor is placed on the character left of
  238.             {char} (inclusive).
  239.             {char} can be entered like with the |f| command.
  240.  
  241.                             *T*
  242. T{char}            Till after [count]'th occurrence of {char} to the
  243.             left.  The cursor is placed on the character right of
  244.             {char} (inclusive).
  245.             {char} can be entered like with the |f| command.
  246.  
  247.                             *;*
  248. ;            Repeat latest f, t, F or T [count] times.
  249.  
  250.                             *,*
  251. ,            Repeat latest f, t, F or T in opposite direction
  252.             [count] times.
  253.  
  254. These commands move the cursor to the specified column in the current line.
  255. They stop at the first column and at the end of the line, except "$", which
  256. may move to one of the next lines.  See 'whichwrap' option to make some of the
  257. commands move across line boundaries.
  258.  
  259. ==============================================================================
  260. 3. Up-down motions                    *up-down-motions*
  261.  
  262. k        or                    *k*
  263. <Up>        or                    *<Up>* *CTRL-P*
  264. CTRL-P            [count] lines upward (linewise).
  265.  
  266. j        or                    *j*
  267. <Down>        or                    *<Down>*
  268. CTRL-J        or                    *CTRL-J*
  269. <NL>        or                    *<NL>* *CTRL-N*
  270. CTRL-N            [count] lines downward (linewise).
  271.  
  272. gk        or                    *gk* *g<Up>*
  273. g<Up>            [count] display lines upward.  |exclusive| motion.
  274.             Differs from 'k' when lines wrap, and when used with
  275.             an operator, because it's not linewise.  {not in Vi}
  276.  
  277. gj        or                    *gj* *g<Down>*
  278. g<Down>            [count] display lines downward.  |exclusive| motion.
  279.             Differs from 'j' when lines wrap, and when used with
  280.             an operator, because it's not linewise.  {not in Vi}
  281.  
  282.                             *-*
  283. -  <minus>        [count] lines upward, on the first non-blank
  284.             character (linewise).
  285.  
  286. +        or                    *+*
  287. CTRL-M        or                    *CTRL-M* *<CR>*
  288. <CR>            [count] lines downward, on the first non-blank
  289.             character (linewise).
  290.  
  291.                             *_*
  292. _  <underscore>        [count] - 1 lines downward, on the first non-blank
  293.             character (linewise).
  294.  
  295. <C-End>        or                    *G* *<C-End>*
  296. G            Goto line [count], default last line, on the first
  297.             non-blank character (linewise).  If 'startofline' not
  298.             set, keep the same column.
  299.  
  300. <C-Home>    or                    *gg* *<C-Home>*
  301. gg            Goto line [count], default first line, on the first
  302.             non-blank character (linewise).  If 'startofline' not
  303.             set, keep the same column.
  304.  
  305. :[range]        Set the cursor on the specified line number.  If
  306.             there are several numbers, the last one is used.
  307.  
  308.                             *N%*
  309. {count}%        Go to {count} percentage in the file, on the first
  310.             non-blank in the line (linewise).  To compute the new
  311.             line number this formula is used:
  312.                 ({count} * number-of-lines + 99) / 100
  313.             See also 'startofline' option.  {not in Vi}
  314.  
  315. :[range]go[to] [count]                    *:go* *:goto* *go*
  316. [count]go        Go to {count} byte in the buffer.  Default [count] is
  317.             zero, start of the file.  When giving [range], the
  318.             last number in it used.  End-of-line characters are
  319.             counted depending on the current 'fileformat' setting.
  320.             {not in Vi}
  321.             {not available when compiled without the
  322.             |+byte_offset| feature}
  323.  
  324. These commands move to the specified line.  They stop when reaching the first
  325. or the last line.  The first two commands put the cursor in the same column
  326. (if possible) as it was after the last command that changed the column,
  327. except after the "$" command, then the cursor will be put on the last
  328. character of the line.
  329.  
  330. ==============================================================================
  331. 4. Word motions                        *word-motions*
  332.  
  333. <S-Right>    or                    *<S-Right>* *w*
  334. w            [count] words forward.  |exclusive| motion.
  335.  
  336. <C-Right>    or                    *<C-Right>* *W*
  337. W            [count] WORDS forward.  |exclusive| motion.
  338.  
  339.                             *e*
  340. e            Forward to the end of word [count] (inclusive).
  341.  
  342.                             *E*
  343. E            Forward to the end of WORD [count] (inclusive).
  344.  
  345. <S-Left>    or                    *<S-Left>* *b*
  346. b            [count] words backward.  |exclusive| motion.
  347.  
  348. <C-Left>    or                    *<C-Left>* *B*
  349. B            [count] WORDS backward.  |exclusive| motion.
  350.  
  351.                             *ge*
  352. ge            Backward to the end of word [count] (inclusive).
  353.  
  354.                             *gE*
  355. gE            Backward to the end of WORD [count] (inclusive).
  356.  
  357. These commands move over words or WORDS.
  358.                             *word*
  359. A word consists of a sequence of letters, digits and underscores, or a
  360. sequence of other non-blank characters, separated with white space (spaces,
  361. tabs, <EOL>).  This can be changed with the 'iskeyword' option.
  362.                             *WORD*
  363. A WORD consists of a sequence of non-blank characters, separated with white
  364. space.  An empty line is also considered to be a word and a WORD.
  365.  
  366. A sequence of folded lines is counted for one word of a single character.
  367. "w" and "W", "e" and "E" move to the start/end of the first word or WORD after
  368. a range of folded lines.  "b" and "B" move to the start of the first word or
  369. WORD before the fold.
  370.  
  371. Special case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is
  372. on a non-blank.  This is because "cw" is interpreted as change-word, and a
  373. word does not include the following white space.  {Vi: "cw" when on a blank
  374. followed by other blanks changes only the first blank; this is probably a
  375. bug, because "dw" deletes all the blanks}
  376.  
  377. Another special case: When using the "w" motion in combination with an
  378. operator and the last word moved over is at the end of a line, the end of
  379. that word becomes the end of the operated text, not the first word in the
  380. next line.
  381.  
  382. The original Vi implementation of "e" is buggy.  For example, the "e" command
  383. will stop on the first character of a line if the previous line was empty.
  384. But when you use "2e" this does not happen.  In Vim "ee" and "2e" are the
  385. same, which is more logical.  However, this causes a small incompatibility
  386. between Vi and Vim.
  387.  
  388. ==============================================================================
  389. 5. Text object motions                    *object-motions*
  390.  
  391.                             *(*
  392. (            [count] sentences backward.  |exclusive| motion.
  393.  
  394.                             *)*
  395. )            [count] sentences forward.  |exclusive| motion.
  396.  
  397.                             *{*
  398. {            [count] paragraphs backward.  |exclusive| motion.
  399.  
  400.                             *}*
  401. }            [count] paragraphs forward.  |exclusive| motion.
  402.  
  403.                             *]]*
  404. ]]            [count] sections forward or to the next '{' in the
  405.             first column.  When used after an operator, then the
  406.             '}' in the first column.  (linewise).
  407.  
  408.                             *][*
  409. ][            [count] sections forward or to the next '}' in the
  410.             first column (linewise).
  411.  
  412.                             *[[*
  413. [[            [count] sections backward or to the previous '{' in
  414.             the first column (linewise).
  415.  
  416.                             *[]*
  417. []            [count] sections backward or to the previous '}' in
  418.             the first column (linewise).
  419.  
  420. These commands move over three kinds of text objects.
  421.  
  422.                             *sentence*
  423. A sentence is defined as ending at a '.', '!' or '?' followed by either the
  424. end of a line, or by a space or tab.  Any number of closing ')', ']', '"'
  425. and ''' characters my appear after the '.', '!' or '?' before the spaces,
  426. tabs or end of line.  A paragraph and section boundary is also a sentence
  427. boundary.
  428. If the 'J' flag is present is 'cpoptions', at least two spaces have to
  429. follow the punctuation mark; <Tab>s are not recognized as white space.
  430. The definition of a sentence cannot be changed.
  431.  
  432.                             *paragraph*
  433. A paragraph begins after each empty line, and also at each of a set of
  434. paragraph macros, specified by the pairs of characters in the 'paragraphs'
  435. option.  The default is "IPLPPPQPP LIpplpipbp", which corresponds to the
  436. macros ".IP", ".LP", etc.  (These are nroff macros, so the dot must be in the
  437. first column).  A section boundary is also a paragraph boundary.  Note that
  438. this does not include a '{' or '}' in the first column.  Also note that a
  439. blank line (only containing white space) is NOT a paragraph boundary.
  440.  
  441.                             *section*
  442. A section begins after a form-feed (<C-L>) in the first column and at each of
  443. a set of section macros, specified by the pairs of characters in the
  444. 'sections' option.  The default is "SHNHH HUnhsh", which defines a section to
  445. start at the nroff macros ".SH", ".NH", ".H", ".HU", ".nh" and ".sh".
  446.  
  447. The "]" and "[" commands stop at the '{' or '}' in the first column.  This is
  448. useful to find the start or end of a function in a C program.  Note that the
  449. first character of the command determines the search direction and the
  450. second character the type of brace found.
  451.  
  452. If your '{' or '}' are not in the first column, and you would like to use "[["
  453. and "]]" anyway, try these mappings: >
  454.    :map [[ ?{<CR>w99[{
  455.    :map ][ /}<CR>b99]}
  456.    :map ]] j0[[%/{<CR>
  457.    :map [] k$][%?}<CR>
  458. [type these literally, see |<>|]
  459.  
  460. ==============================================================================
  461. 6. Text object selection            *object-select* *text-objects*
  462.                         *v_a* *v_i*
  463.  
  464. This is a series of commands that can only be used while in Visual mode or
  465. after an operator.  The commands that start with "a" select "a"n object
  466. including white space, the commands starting with "i" select an "inner" object
  467. without white space, or just the white space.  Thus the "inner" commands
  468. always select less text than the "a" commands.
  469.  
  470. These commands are {not in Vi}.
  471. These commands are not available when the |+textobjects| feature has been
  472. disabled at compile time.
  473.                             *v_aw* *aw*
  474. aw            "a word", select [count] words (see |word|).
  475.             Leading or trailing white space is included, but not
  476.             counted.
  477.             When used in Visual linewise mode "aw" switches to
  478.             Visual characterwise mode.
  479.  
  480.                             *v_iw* *iw*
  481. iw            "inner word", select [count] words (see |word|).
  482.             White space between words is counted too.
  483.             When used in Visual linewise mode "iw" switches to
  484.             Visual characterwise mode.
  485.  
  486.                             *v_aW* *aW*
  487. aW            "a WORD", select [count] WORDs (see |WORD|).
  488.             Leading or trailing white space is included, but not
  489.             counted.
  490.             When used in Visual linewise mode "aW" switches to
  491.             Visual characterwise mode.
  492.  
  493.                             *v_iW* *iW*
  494. iW            "inner WORD", select [count] WORDs (see |WORD|).
  495.             White space between words is counted too.
  496.             When used in Visual linewise mode "iW" switches to
  497.             Visual characterwise mode.
  498.  
  499.                             *v_as* *as*
  500. as            "a sentence", select [count] sentences (see
  501.             |sentence|).
  502.             When used in Visual mode it is made characterwise.
  503.  
  504.                             *v_is* *is*
  505. is            "inner sentence", select [count] sentences (see
  506.             |sentence|).
  507.             When used in Visual mode it is made characterwise.
  508.  
  509.                             *v_ap* *ap*
  510. ap            "a paragraph", select [count] paragraphs (see
  511.             |paragraph|).
  512.             When used in Visual mode it is made linewise.
  513.  
  514.                             *v_ip* *ip*
  515. ip            "inner paragraph", select [count] paragraphs (see
  516.             |paragraph|).
  517.             When used in Visual mode it is made linewise.
  518.  
  519. a]                        *v_a]* *v_a[* *a]* *a[*
  520. a[            "a [] block", select [count] '[' ']' blocks.  This
  521.             goes backwards to the [count] unclosed '[', and finds
  522.             the matching ']'.  The enclosed text is selected,
  523.             including the '[' and ']'.
  524.             When used in Visual mode it is made characterwise.
  525.  
  526. i]                        *v_i]* *v_i[* *i]* *i[*
  527. i[            "inner [] block", select [count] '[' ']' blocks.  This
  528.             goes backwards to the [count] unclosed '[', and finds
  529.             the matching ']'.  The enclosed text is selected,
  530.             excluding the '[' and ']'.
  531.             When used in Visual mode it is made characterwise.
  532.  
  533. a)                            *v_a)* *a)* *a(*
  534. a(                            *v_ab* *v_a(* *ab*
  535. ab            "a block", select [count] blocks, from "[count] [(" to
  536.             the matching ')', including the '(' and ')' (see
  537.             |[(|).
  538.             When used in Visual mode it is made characterwise.
  539.  
  540. i)                            *v_i)* *i)* *i(*
  541. i(                            *v_ib* *v_i(* *ib*
  542. ib            "inner block", select [count] blocks, from "[count] [("
  543.             to the matching ')', excluding the '(' and ')' (see
  544.             |[(|).
  545.             When used in Visual mode it is made characterwise.
  546.  
  547. a>                        *v_a>* *v_a<* *a>* *a<*
  548. a<            "a <> block", select [count] <> blocks, from the
  549.             [count]'th unmatched '<' backwards to the matching
  550.             '>', including the '<' and '>'.
  551.             When used in Visual mode it is made characterwise.
  552.  
  553. i>                        *v_i>* *v_i<* *i>* *i<*
  554. i<            "inner <> block", select [count] <> blocks, from
  555.             the [count]'th unmatched '<' backwards to the matching
  556.             '>', excluding the '<' and '>'.
  557.             When used in Visual mode it is made characterwise.
  558.  
  559. a}                            *v_a}* *a}* *a{*
  560. a{                            *v_aB* *v_a{* *aB*
  561. aB            "a Block", select [count] Blocks, from "[count] [{" to
  562.             the matching '}', including the '{' and '}' (see
  563.             |[{|).
  564.             When used in Visual mode it is made characterwise.
  565.  
  566. i}                            *v_i}* *i}* *i{*
  567. i{                            *v_iB* *v_i{* *iB*
  568. iB            "inner Block", select [count] Blocks, from "[count] [{"
  569.             to the matching '}', excluding the '{' and '}' (see
  570.             |[{|).
  571.             When used in Visual mode it is made characterwise.
  572.  
  573. When used after an operator:
  574. For non-block objects:
  575.     For the "a" commands: The operator applies to the object and the white
  576.     space after the object.  If there is no white space after the object
  577.     or when the cursor was in the white space before the object, the white
  578.     space before the object is included.
  579.     For the "inner" commands: If the cursor was on the object, the
  580.     operator applies to the object.  If the cursor was on white space, the
  581.     operator applies to the white space.
  582. For a block object:
  583.     The operator applies to the block where the cursor is in, or the block
  584.     on which the cursor is on one of the braces.  For the "inner" commands
  585.     the surrounding braces are excluded.  For the "a" commands, the braces
  586.     are included.
  587.  
  588. When used in Visual mode:
  589. When start and end of the Visual area are the same (just after typing "v"):
  590.     One object is selected, the same as for using an operator.
  591. When start and end of the Visual area are not the same:
  592.     For non-block objects the area is extended by one object or the white
  593.     space up to the next object, or both for the "a" objects.  The
  594.     direction in which this happens depends on which side of the Visual
  595.     area the cursor is.  For the block objects the block is extended one
  596.     level outwards.
  597.  
  598. For illustration, here is a list of delete commands, grouped from small to big
  599. objects.  Note that for a single character and a whole line the existing vi
  600. movement commands are used.
  601.     "dl"    delete character (alias: "x")        |dl|
  602.     "diw"    delete inner word            *diw*
  603.     "daw"    delete a word                *daw*
  604.     "diW"    delete inner WORD (see |WORD|)        *diW*
  605.     "daW"    delete a WORD (see |WORD|)        *daW*
  606.     "dd"    delete one line                |dd|
  607.     "dis"    delete inner sentence            *dis*
  608.     "das"    delete a sentence            *das*
  609.     "dib"    delete inner '(' ')' block        *dib*
  610.     "dab"    delete a '(' ')' block            *dab*
  611.     "dip"    delete inner paragraph            *dip*
  612.     "dap"    delete a paragraph            *dap*
  613.     "diB"    delete inner '{' '}' block        *diB*
  614.     "daB"    delete a '{' '}' block            *daB*
  615.  
  616. Note the difference between using a movement command and an object.  The
  617. movement command operates from here (cursor position) to where the movement
  618. takes us.  When using an object the whole object is operated upon, no matter
  619. where on the object the cursor is.  For example, compare "dw" and "da": "dw"
  620. deletes from the cursor position to the start of the next word, "da" deletes
  621. the word under the cursor and the space after or before it.
  622.  
  623. ==============================================================================
  624. 7. Marks                    *mark-motions* *E20* *E78*
  625.  
  626. Jumping to a mark can be done in two ways:
  627. 1. With ` (backtick):      The cursor is positioned at the specified location
  628.               and the motion is |exclusive|.
  629. 2. With ' (single quote): The cursor is positioned on the first non-blank
  630.               character in the line of the specified location and
  631.               the motion is linewise.
  632.  
  633.                         *m* *mark* *Mark*
  634. m{a-zA-Z}        Set mark {a-zA-Z} at cursor position (does not move
  635.             the cursor, this is not a motion command).
  636.  
  637. m'  or  m`        Set the previous context mark.  This can be jumped to
  638.             with the "''" or "``" command (does not move the
  639.             cursor, this is not a motion command).
  640.  
  641.                         *:ma* *:mark* *E191*
  642. :[range]ma[rk] {a-zA-Z}    Set mark {a-zA-Z} at last line number in [range],
  643.             column 0.  Default is cursor line.
  644.  
  645.                         *:k*
  646. :[range]k{a-zA-Z}    Same as :mark, but the space before the mark name can
  647.             be omitted.
  648.  
  649.                         *'* *'a* *`* *`a*
  650. '{a-z}  `{a-z}        Jump to the mark {a-z}.
  651.  
  652.                         *'A* *'0* *`A* *`0*
  653. '{A-Z0-9}  `{A-Z0-9}    To the mark {A-Z0-9} in the correct file (not a motion
  654.             command when in another file).  {not in Vi}
  655.  
  656.                         *g'* *g'a* *g`* *g`a*
  657. g'{mark}  g`{mark}
  658.             Jump to the {mark}, but don't change the jumplist when
  659.             jumping within the current buffer.  Example: >
  660.                 g`"
  661. <            jumps to the last known position in a file.  See
  662.             $VIMRUNTIME/vimrc_example.vim.  {not in Vi}
  663.  
  664.                         *:marks*
  665. :marks            List all the current marks (not a motion command).
  666.             The |'(|, |')|, |'{| and |'}| marks are not listed.
  667.             {not in Vi}
  668.                         *E283*
  669. :marks {arg}        List the marks that are mentioned in {arg} (not a
  670.             motion command).  For example: >
  671.                 :marks aB
  672. <            to list marks 'a' and 'B'.  {not in Vi}
  673.  
  674. A mark is not visible in any way.  It is just a position in the file that is
  675. remembered.  Do not confuse marks with named registers, they are totally
  676. unrelated.
  677.  
  678. 'a - 'z        lowercase marks, valid within one file
  679. 'A - 'Z        uppercase marks, also called file marks, valid between files
  680. '0 - '9        numbered marks, set from .viminfo file
  681.  
  682. Lowercase marks 'a to 'z are remembered as long as the file remains in the
  683. buffer list.  If you remove the file from the buffer list, all its marks are
  684. lost.  If you delete a line that contains a mark, that mark is erased.
  685. Lowercase marks can be used in combination with operators.  For example: "d't"
  686. deletes the lines from the cursor position to mark 't'.  Hint: Use mark 't' for
  687. Top, 'b' for Bottom, etc..  Lowercase marks are restored when using undo and
  688. redo.
  689.  
  690. Uppercase marks 'A to 'Z include the file name.  {Vi: no uppercase marks} You
  691. can use them to jump from file to file.  You can only use an uppercase mark
  692. with an operator if the mark is in the current file.  The line number of the
  693. mark remains correct, even if you insert/delete lines or edit another file for
  694. a moment.  When the 'viminfo' option is not empty, uppercase marks are kept in
  695. the .viminfo file.  See |viminfo-file-marks|.
  696.  
  697. Numbered marks '0 to '9 are quite different.  They can not be set directly.
  698. They are only present when using a viminfo file |viminfo-file|.  Basically '0
  699. is the location of the cursor when you last exited Vim, '1 the last but one
  700. time, etc.  See |viminfo-file-marks|.
  701.  
  702.  
  703.                             *'[* *`[*
  704. '[  `[            To the first character of the previously changed
  705.             or yanked text.  {not in Vi}
  706.  
  707.                             *']* *`]*
  708. ']  `]            To the last character of the previously changed or
  709.             yanked text.  {not in Vi}
  710.  
  711. After executing an operator the Cursor is put at the beginning of the text
  712. that was operated upon.  After a put command ("p" or "P") the cursor is
  713. sometimes placed at the first inserted line and sometimes on the last inserted
  714. character.  The four commands above put the cursor at either end.  Example:
  715. After yanking 10 lines you want to go to the last one of them: "10Y']".  After
  716. inserting several lines with the "p" command you want to jump to the lowest
  717. inserted line: "p']".  This also works for text that has been inserted.
  718.  
  719. Note: After deleting text, the start and end positions are the same, except
  720. when using blockwise Visual mode.  These commands do not work when no change
  721. was made yet in the current file.
  722.  
  723.                             *'<* *`<*
  724. '<  `<            To the first character of the last selected Visual
  725.             area in the current buffer.  {not in Vi}.
  726.  
  727.                             *'>* *`>*
  728. '>  `>            To the last character of the last selected Visual
  729.             area in the current buffer.  {not in Vi}.
  730.  
  731.                             *''* *``*
  732. ''  ``            To the position before latest jump, or where the last
  733.             "m'" or "m`" command was given.
  734.             Also see |restore-position|.
  735.  
  736.                             *'quote* *`quote*
  737. '"  `"            To the cursor position when last exiting the current
  738.             buffer.  Defaults to the first character of the first
  739.             line.  See |last-position-jump| for how to use this
  740.             for each opened file.
  741.             Only one position is remembered per buffer, not one
  742.             for each window.  As long as the buffer is visible in
  743.             a window the position won't be changed.
  744.             {not in Vi}.
  745.  
  746.                             *'^* *`^*
  747. '^  `^            To the position where the cursor was the last time
  748.             when Insert mode was stopped  This is used by the |gi|
  749.             command.  {not in Vi}
  750.  
  751.                             *'.* *`.*
  752. '.  `.            To the position where the last change was made.  The
  753.             position is at or near where the change started.
  754.             Sometimes a command is executed as several changes,
  755.             then the position can be near the end of what the
  756.             command changed.  For example when inserting a word,
  757.             the position will be on the last character.
  758.             {not in Vi}
  759.  
  760.                             *'(* *`(*
  761. '(  `(            To the start of the current paragraph, like the |(|
  762.             command.  {not in Vi}
  763.  
  764.                             *')* *`)*
  765. ')  `)            To the end of the current sentence, like the |)|
  766.             command.  {not in Vi}
  767.  
  768.                             *'{* *`{*
  769. '{  `{            To the start of the current paragraph, like the |{|
  770.             command.  {not in Vi}
  771.  
  772.                             *'}* *`}*
  773. '}  `}            To the end of the current paragraph, like the |}|
  774.             command.  {not in Vi}
  775.  
  776. These commands are not marks themselves, but jump to a mark:
  777.  
  778.                             *]'*
  779. ]'            [count] times to next line with a lowercase mark below
  780.             the cursor, on the first non-blank character in the
  781.             line. {not in Vi}
  782.  
  783.                             *]`*
  784. ]`            [count] times to lowercase mark after the cursor. {not
  785.             in Vi}
  786.  
  787.                             *['*
  788. ['            [count] times to previous line with a lowercase mark
  789.             before the cursor, on the first non-blank character in
  790.             the line. {not in Vi}
  791.  
  792.                             *[`*
  793. [`            [count] times to lowercase mark before the cursor.
  794.             {not in Vi}
  795.  
  796. ==============================================================================
  797. 8. Jumps                    *jump-motions*
  798.  
  799. A "jump" is one of the following commands: "'", "`", "G", "/", "?", "n",
  800. "N", "%", "(", ")", "[[", "]]", "{", "}", ":s", ":tag", "L", "M", "H" and
  801. the commands that start editing a new file.  If you make the cursor "jump"
  802. with one of these commands, the position of the cursor before the jump is
  803. remembered.  You can return to that position with the "''" and "``" command,
  804. unless the line containing that position was changed or deleted.
  805.  
  806.                             *CTRL-O*
  807. CTRL-O            Go to [count] Older cursor position in jump list
  808.             (not a motion command).  {not in Vi}
  809.             {not available without the +jumplist feature}
  810.  
  811. <Tab>        or                    *CTRL-I* *<Tab>*
  812. CTRL-I            Go to [count] newer cursor position in jump list
  813.             (not a motion command).
  814.             In a |quickfix-window| it takes you to the position of
  815.             the error under the cursor.
  816.             {not in Vi}
  817.             {not available without the +jumplist feature}
  818.  
  819.                             *:ju* *:jumps*
  820. :ju[mps]        Print the jump list (not a motion command).  {not in
  821.             Vi} {not available without the +jumplist feature}
  822.  
  823.                             *jumplist*
  824. Jumps are remembered in a jump list.  With the CTRL-O and CTRL-I command you
  825. can go to cursor positions before older jumps, and back again.  Thus you can
  826. move up and down the list.  There is a separate jump list for each window.
  827. The maximum number of entries is fixed at 100.
  828. {not available without the +jumplist feature}
  829.  
  830. For example, after three jump commands you have this jump list: >
  831.  
  832.   jump line  file/line
  833.     3      1  some text
  834.     2     70  another line
  835.     1  1154  end.
  836.  >
  837.  
  838. The "file/line" column shows the file name, or the text at the jump if it is
  839. in the current file (an indent is removed and a long line is truncated to fit
  840. in the window).
  841.  
  842. You are currently in line 1167.  If you then use the CTRL-O command, the
  843. cursor is put in line 1154.  This results in: >
  844.  
  845.   jump line  file/line
  846.     2      1  some text
  847.     1     70  another line
  848.  >  0  1154  end.
  849.     1  1167  foo bar
  850.  
  851. The pointer will be set at the last used jump position.  The next CTRL-O
  852. command will use the entry above it, the next CTRL-I command will use the
  853. entry below it.  If the pointer is below the last entry, this indicates that
  854. you did not use a CTRL-I or CTRL-O before.  In this case the CTRL-O command
  855. will cause the cursor position to be added to the jump list, so you can get
  856. back to the position before the CTRL-O.  In this case this is line 1167.
  857.  
  858. With more CTRL-O commands you will go to lines 70 and 1.  If you use CTRL-I
  859. you can go back to 1154 and 1167 again.  Note that the number in the "jump"
  860. column indicates the count for the CTRL-O or CTRL-I command that takes you to
  861. this position.
  862.  
  863. If you use a jump command, the current line number is inserted at the end of
  864. the jump list.  If the same line was already in the jump list, it is removed.
  865. The result is that when repeating CTRL-O you will get back to old positions
  866. only once.
  867.  
  868. After the CTRL-O command that got you into line 1154 you could give another
  869. jump command (e.g., "G").  The jump list would then become: >
  870.  
  871.   jump line  file/line
  872.     4      1  some text
  873.     3     70  another line
  874.     2  1167  foo bar
  875.     1  1154  end.
  876.  >
  877.  
  878. The line numbers will be adjusted for deleted and inserted lines.  This fails
  879. if you stop editing a file without writing, like with ":n!".
  880.  
  881. When you split a window, the jumplist will be copied to the new window.
  882.  
  883. If you have included the ' item in the 'viminfo' option the jumplist will be
  884. stored in the viminfo file and restored when starting Vim.
  885.  
  886. ==============================================================================
  887. 9. Various motions                *various-motions*
  888.  
  889.                             *%*
  890. %            Find the next item in this line after or under the
  891.             cursor and jump to its match (inclusive).  Items can
  892.             be:
  893.             ([{}])        parenthesis or (curly/square) brackets
  894.                     (this can be changed with the
  895.                     'matchpairs' option)
  896.             /* */        start or end of C-style comment
  897.             #if, #ifdef, #else, #elif, #endif
  898.                     C preprocessor conditionals
  899.             Parens and braces preceded with a backslash are
  900.             ignored.  When the '%' character is not present in
  901.             'cpoptions', parens and braces inside double quotes
  902.             are ignored, unless the number of parens/braces in a
  903.             line is uneven and this line and the previous one does
  904.             not end in a backslash.  '(', '{', '[', ']', '}' and
  905.             ')' are also ignored (parens and braces inside single
  906.             quotes).  Note that this works fine for C, but not for
  907.             Perl, where single quotes are used for strings.
  908.             No count is allowed ({count}% jumps to a line {count}
  909.             percentage down the file |N%|).  Using '%' on
  910.             #if/#else/#endif makes the movement linewise.
  911.  
  912.                         *[(*
  913. [(            go to [count] previous unmatched '('.  {not in Vi}
  914.  
  915.                         *[{*
  916. [{            go to [count] previous unmatched '{'.  {not in Vi}
  917.  
  918.                         *])*
  919. ])            go to [count] next unmatched ')'.  {not in Vi}
  920.  
  921.                         *]}*
  922. ]}            go to [count] next unmatched '}'.  {not in Vi}
  923.  
  924. The above four commands can be used to go to the start or end of the current
  925. code block.  It is like doing "%" on the '(', ')', '{' or '}' at the other
  926. end of the code block, but you can do this from anywhere in the code block.
  927. Very useful for C programs.  Example: When standing on "case x:", "[{" will
  928. bring you back to the switch statement.
  929.  
  930.                         *]m*
  931. ]m            Go to [count] next start of a method (for Java or
  932.             similar structured language).  When not before the
  933.             start of a method, jump to the start or end of the
  934.             class.  When no '{' is found after the cursor, this is
  935.             an error.  {not in Vi}
  936.                         *]M*
  937. ]M            Go to [count] next end of a method (for Java or
  938.             similar structured language).  When not before the end
  939.             of a method, jump to the start or end of the class.
  940.             When no '}' is found after the cursor, this is an
  941.             error. {not in Vi}
  942.                         *[m*
  943. [m            Go to [count] previous start of a method (for Java or
  944.             similar structured language).  When not after the
  945.             start of a method, jump to the start or end of the
  946.             class.  When no '{' is found before the cursor this is
  947.             an error. {not in Vi}
  948.                         *[M*
  949. [M            Go to [count] previous end of a method (for Java or
  950.             similar structured language).  When not after the
  951.             end of a method, jump to the start or end of the
  952.             class.  When no '}' is found before the cursor this is
  953.             an error. {not in Vi}
  954.  
  955. The above two commands assume that the file contains a class with methods.
  956. The class definition is surrounded in '{' and '}'.  Each method in the class
  957. is also surrounded with '{' and '}'.  This applies to the Java language.  The
  958. file looks like this: >
  959.  
  960.     // comment
  961.     class foo {
  962.         int method_one() {
  963.             body_one();
  964.         }
  965.         int method_two() {
  966.             body_two();
  967.         }
  968.     }
  969. Starting with the cursor on "body_two()", using "[m" will jump to the '{' at
  970. the start of "method_two()" (obviously this is much more useful when the
  971. method is long!).  Using "2[m" will jump to the start of "method_one()".
  972. Using "3[m" will jump to the start of the class.
  973.  
  974.                         *[#*
  975. [#            go to [count] previous unmatched "#if" or "#else".
  976.             {not in Vi}
  977.  
  978.                         *]#*
  979. ]#            go to [count] next unmatched "#else" or "#endif".  {not
  980.             in Vi}
  981.  
  982. These two commands work in C programs that contain #if/#else/#endif
  983. constructs.  It brings you to the start or end of the #if/#else/#endif where
  984. the current line is included.  You can then use "%" to go to the matching line.
  985.  
  986.                         *[star* *[/*
  987. [*  or  [/        go to [count] previous start of a C comment "/*".  {not
  988.             in Vi}
  989.  
  990.                         *]star* *]/*
  991. ]*  or  ]/        go to [count] next end of a C comment "*/".  {not
  992.             in Vi}
  993.  
  994.  
  995.                         *H*
  996. H            To line [count] from top (Home) of screen (default:
  997.             first line on the screen) on the first non-blank
  998.             character (linewise).  See also 'startofline' option.
  999.             Cursor is adjusted for 'scrolloff' option.
  1000.  
  1001.                         *M*
  1002. M            To Middle line of screen, on the first non-blank
  1003.             character (linewise).  See also 'startofline' option.
  1004.  
  1005.                         *L*
  1006. L            To line [count] from bottom of screen (default: Last
  1007.             line on the screen) on the first non-blank character
  1008.             (linewise).  See also 'startofline' option.
  1009.             Cursor is adjusted for 'scrolloff' option.
  1010.  
  1011. <LeftMouse>        Moves to the position on the screen where the mouse
  1012.             click is (inclusive).  See also |<LeftMouse>|.  If the
  1013.             position is in a status line, that window is made the
  1014.             active window and the cursor is not moved.  {not in Vi}
  1015.  
  1016.  vim:tw=78:ts=8:ft=help:norl:
  1017.